import { createSlice } from '@reduxjs/toolkit';


export const homeSlice = createSlice({
  name: 'home',
  initialState: {
    active: 0,
    recommend: null,
    story: null,
  },
  reducers: {
    changeDate: (state, action) => {
      state.recommend = action.payload.recommend;
      state.story = action.payload.story;
    },

    changeActive: (state, action) => {
      state.active = action.payload;
    },
  }
});

export const { changeDate, changeActive } = homeSlice.actions;
export const selectActive = (state) => state.home.active;
export const selectRecommend = (state) => state.home.recommend;
export const selectStory = (state) => state.home.story;

export default homeSlice.reducer;
